
import { join } from 'path'
import icon from '../resources/icon.png?asset'
import { BrowserWindowConstructorOptions } from 'electron'

const commonConfig: BrowserWindowConstructorOptions = {
    width: 900,
    height: 670,
    show: false,
    autoHideMenuBar: true,
    icon,
    titleBarStyle: "hidden",
    ...(process.platform !== 'darwin' ? {
        titleBarOverlay: {
            color: '#fff',
            symbolColor: '#74b1be',
            height: 30
        }
    } : {}),
    webPreferences: {
        preload: join(__dirname, '../preload/index.js'),
        sandbox: false,
        webSecurity: false,
        allowRunningInsecureContent: true,
        contextIsolation: true,  //false 允许渲染进程使用nodejs
        partition: 'persist:default', // 使用默认持久化分区

    }
}


export const mainWindowConfig: BrowserWindowConstructorOptions = {
    ...commonConfig,
    titleBarStyle: "default",
}

export const createdWindowConfig: BrowserWindowConstructorOptions = {
    ...commonConfig,
    // 无边框模式
    frame: false,
    titleBarOverlay: false
}